#关闭所有容器
docker stop $(docker ps -a | awk '{ print $1}' | tail -n +2)

#删除所有容器
docker rm $(docker ps -a | awk '{ print $1}' | tail -n +2)

cd /Users/huangyongkeng && docker-compose up -d

#修改apt-get镜像源
docker exec -i my_php /bin/bash -c "echo \"
deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
\" >> /etc/apt/sources.list
"

#更新apt-get
docker exec -i my_php /bin/bash -c "apt-get update"

docker exec -i my_php /bin/bash -c "apt-get -y install zip unzip git"

#下载并安装gd扩展
docker exec -i my_php /bin/bash -c "docker-php-ext-install gd"
docker exec -i my_php /bin/bash -c "docker-php-ext-enable gd"
#下载并安装pdo和pdo_mysql扩展
docker exec -i my_php /bin/bash -c "docker-php-ext-install pdo pdo_mysql"
docker exec -i my_php /bin/bash -c "docker-php-ext-enable pdo pdo_mysql"

#下载并安装redis扩展
docker exec -i my_php /bin/bash -c "apt-get install wget"
docker exec -i my_php /bin/bash -c "cd /usr/local/include/php/ext && wget http://pecl.php.net/get/redis-4.3.0.tgz"
docker exec -i my_php /bin/bash -c "cd /usr/local/include/php/ext && tar -zxvf redis-4.3.0.tgz"
docker exec -i my_php /bin/bash -c "cd /usr/local/include/php/ext/redis-4.3.0 && /usr/local/bin/phpize"
docker exec -i my_php /bin/bash -c "mv /usr/local/include/php/ext/redis-4.3.0 /usr/src/php/ext/redis"
docker exec -i my_php /bin/bash -c "docker-php-ext-install redis"
docker exec -i my_php /bin/bash -c "docker-php-ext-enable redis"

docker exec -i my_php /bin/bash -c "docker-php-ext-install mysqli"
docker restart my_php
